<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Return info about all open connections</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="mongoclient.get.html">« MongoClient::__get</a></li>
      <li style="float: right;"><a href="mongoclient.gethosts.html">MongoClient::getHosts »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongoclient.html">MongoClient</a></li>
    <li>Return info about all open connections</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongoclient.getconnections" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoClient::getConnections</h1>
  <p class="verinfo">(PECL mongo &gt;=1.3.0)</p><p class="refpurpose"><span class="refname">MongoClient::getConnections</span> &mdash; <span class="dc-title">Return info about all open connections</span></p>

 </div>

 <div id="mongoclient.getconnections-soft-deprecation-notice" class="soft-deprecation-notice">
  <p class="para">This extension that defines this method
is deprecated. Instead, the <a href="" class="link">MongoDB</a> extension should be used.
There is no equivalent for this method in the new extension.</p>
 </div>

 <div class="refsect1 description" id="refsect1-mongoclient.getconnections-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>MongoClient::getConnections</strong></span>(): <span class="type">array</span></div>

  <p class="para rdfs-comment">
  Returns an array of all open connections, and information about each of the
  servers 
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongoclient.getconnections-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongoclient.getconnections-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
  An <span class="type">array</span> of open connections.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongoclient.getconnections-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="mongoclient-getconnections.example.basic">
   <p><strong>Example #1 <span class="methodname"><strong>MongoClient::getConnections()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">MongoClient</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getConnections</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(1) {
  [0]=&gt;
  array(3) {
    [&quot;hash&quot;]=&gt;
    string(26) &quot;localhost:27017;-;X;56052&quot;
    [&quot;server&quot;]=&gt;
    array(3) {
      [&quot;host&quot;]=&gt;
      string(10) &quot;localhost&quot;
      [&quot;port&quot;]=&gt;
      int(27017)
      [&quot;pid&quot;]=&gt;
      int(56052)
    }
    [&quot;connection&quot;]=&gt;
    array(8) {
      [&quot;last_ping&quot;]=&gt;
      int(1354076401)
      [&quot;last_ismaster&quot;]=&gt;
      int(0)
      [&quot;ping_ms&quot;]=&gt;
      int(0)
      [&quot;connection_type&quot;]=&gt;
      int(1)
      [&quot;connection_type_desc&quot;]=&gt;
      string(10) &quot;STANDALONE&quot;
      [&quot;max_bson_size&quot;]=&gt;
      int(16777216)
      [&quot;tag_count&quot;]=&gt;
      int(0)
      [&quot;tags&quot;]=&gt;
      array(0) {
      }
    }
  }
}
</pre></div>
   </div>
  </div>
 </div>



</div></div></div></body></html>